package com.atguigu.gmall.all.controller;


import com.atguigu.gmall.item.client.ItemFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.Map;


/**
 * @Description: TODO
 * @Author: Mr.Cao
 * @DateTime: 2021/10/11 21:03
 * BMW F750GS
 **/
@Controller
public class ItemController {

    @Autowired
    ItemFeignClient itemFeignClient;

    //去商品详情页面
    @RequestMapping("/{skuId}.html")
    public String getItem(@PathVariable long skuId, Map map){
        //将数据放在request域里
        Map item = itemFeignClient.getItem(skuId);
       map.putAll(item);
        return "item/index";
    }
}
